home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / d3_global.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  7.1 KB  |  302 lines

  1. /*****************************************************************************
  2.   FILE           : d3_global.h
  3.   SHORTNAME      : global.ph
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : type definitions and global defines
  7.   NOTES          : all global types are defined here
  8.                    this is the only module for global variables
  9.                    most varaibles are initilized
  10.                    the default values could be changed here
  11.  
  12.   AUTHOR         : Ralf Huebner
  13.   DATE           : 1.12.1991
  14.  
  15.   CHANGED BY     : Sven Doering, Niels Mache
  16.   IDENTIFICATION : @(#)d3_global.h    1.13 3/2/94
  17.   SCCS VERSION   : 1.13
  18.   LAST CHANGE    : 3/2/94
  19.  
  20.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  21.  
  22. ******************************************************************************/
  23. #ifndef _D3GLOBAL_DEFINED_
  24. #define _D3GLOBAL_DEFINED_
  25.  
  26.  
  27.  
  28. #ifndef D3_GLOBAL_DEFS
  29. #define D3_GLOBAL_DEFS
  30.  
  31.  
  32. #ifndef ZERO
  33. #define ZERO 0
  34. #endif
  35.  
  36.  
  37.  
  38. #define ANZ_VECS        9
  39. #define ANZ_LINES      12
  40. #define ANZ_PKT_LINE    2
  41. #define ANZ_FACETS      6
  42. #define ANZ_PKT_FACETS  4
  43.  
  44.  
  45.  
  46.  
  47. /*****************************************************************************
  48.    
  49.                              type definitions
  50.  
  51. ******************************************************************************/
  52.  
  53.  
  54.  
  55.  
  56. typedef float vector [4];         /* vector type */
  57. typedef float matrix [4][4];      /* matrix type */
  58. typedef vector cube [ANZ_VECS];   /* cube type   */
  59.  
  60.  
  61. typedef struct {                   /* polygon            */
  62.     int n;                         /* number of sides    */
  63.     int mask;                      /* interpolation mask */
  64.     vector vert[ANZ_PKT_FACETS];   /* vertices           */
  65. } d3_polygon_type;
  66.  
  67.  
  68.  
  69. typedef struct {                   /* unit_mode               */
  70.     int size;                      /* show value as size      */
  71.     int color;                     /* show value as color     */
  72.     int top_label;                 /* show value on top label */
  73.     int bottom_label;              /* show value bottom label */ 
  74. } d3_unit_mode_type;
  75.  
  76.  
  77.  
  78. typedef struct {                    /*  light_type                      */
  79.     int shade_mode;                 /*  shading mode                    */
  80.     vector position;                /*  light source position           */
  81.     float Ia;                       /*  ambient light intensity         */
  82.     float Ka;                       /*  ambient reflection coefficient  */
  83.     float Ip;                       /*  point light intensity           */
  84.     float Kd;                       /*  diffuse refection coefficient   */
  85. } d3_light_type;
  86.  
  87.  
  88.  
  89.  
  90.  
  91. typedef struct {
  92.     vector trans_vec, rot_vec, scale_vec;    /* translation, rotation, scale      */
  93.     vector trans_step, rot_step, scale_step; /* translation, rotation, scale step */
  94.     vector viewpoint;                        /* viewpoint for perspective         */
  95.     float unit_aspect;                       /* aspect beteen the size and  space */
  96.     float link_scale;                        /* scale for the links               */
  97.     float pos_link_trigger;                  /* positive trigger for the links    */
  98.     float neg_link_trigger;                  /* negative trigger for the links    */
  99.     int font;                                /* 3D font                           */
  100.     int projection_mode;                     /* central or parallel               */
  101.     int model_mode;                          /* solid or wireframe                */
  102.     int color_mode;                          /* mono or rgb                       */
  103.     int link_mode;                           /* shows link values                 */
  104.     d3_unit_mode_type  unit_mode;            /* shows unit values                 */
  105.     d3_light_type light;                     /* light source                      */
  106. } d3_state_type;
  107.  
  108.  
  109. typedef struct {                             /* WINDOW */
  110.      int x0, y0;                             /* xmin and ymin */
  111.      int x1, y1;                             /* xmax and ymax */
  112. } d3_window_type;
  113.  
  114.  
  115. struct d3_unitPtrDef {                       /* linear list type      */ 
  116.      int unitNo;                             /* key                   */
  117.      struct d3_unitPtrDef *next;             /* pointer to next item  */
  118. };
  119.  
  120.  
  121. typedef struct d3_unitPtrDef d3_unitPtrType;
  122.  
  123.  
  124. /*****************************************************************************
  125.    
  126.                              mode definitions
  127.  
  128. ******************************************************************************/
  129.  
  130.  
  131. /*   projection_mode   */
  132.  
  133. #define central         0
  134. #define parallel        1
  135.  
  136.  
  137.  
  138. /*   model_mode  */
  139.  
  140. #define wire_frame      0
  141. #define solid           1
  142.  
  143.  
  144.  
  145. /*   color_mode */
  146.  
  147. #define mono_mode       0
  148. #define gray_mode       1
  149. #define rgb_mode        2
  150.  
  151.  
  152.  
  153. /*   unit_mode   */
  154.  
  155. #define nothing_on      0
  156. #define activation_on   1
  157. #define init_act_on     2
  158. #define output_on       3
  159. #define bias_on         4
  160. #define name_on         5
  161. #define number_on       6
  162. #define zvalue_on       7
  163.  
  164.  
  165.  
  166. /*   link_mode   */
  167.  
  168. #define links_on        0
  169. #define links_off       1
  170. #define links_label     2
  171. #define links_color     3
  172.  
  173.  
  174.  
  175. /*   light_mode  */
  176.  
  177. #define shade_off       0
  178. #define shade_constant  1
  179.  
  180.  
  181. /*****************************************************************************
  182.    
  183.                                  makros
  184.  
  185. ******************************************************************************/
  186.  
  187.  
  188. #ifndef PI
  189. #define PI 3.1415926
  190. #endif
  191.  
  192. #define rad(phi)  (phi / 180.0) * PI            /* radiant to degrees   */
  193. #define deg(phi)  (180.0 * phi) / PI            /* degrees to radiant   */
  194.  
  195. #define WAIT  {char ch; scanf ("%c", &ch);}     /* wait for a keystroke */
  196.  
  197.  
  198.  
  199.  
  200. /*****************************************************************************
  201.    
  202.                             global defines
  203.  
  204. ******************************************************************************/
  205.  
  206.  
  207.  
  208. /* X fonts */
  209.  
  210. #define d3_fontWidth 8
  211.  
  212. /* d3 fonts */
  213.  
  214. #define fnt5x8    0
  215. #define fnt8x14   1
  216. #define fnt5x7    2
  217.  
  218.  
  219. /* transformations */ 
  220.  
  221.  
  222. #define ROT_X_LEFT     0
  223. #define ROT_X_RIGHT    1
  224. #define ROT_Y_LEFT     2
  225. #define ROT_Y_RIGHT    3
  226. #define ROT_Z_LEFT     4
  227. #define ROT_Z_RIGHT    5
  228. #define TRANS_X_LEFT   6
  229. #define TRANS_X_RIGHT  7
  230. #define TRANS_Y_LEFT   8
  231. #define TRANS_Y_RIGHT  9
  232. #define TRANS_Z_LEFT  10
  233. #define TRANS_Z_RIGHT 11
  234. #define SCALE_PLUS    12
  235. #define SCALE_MINUS   13
  236.  
  237.  
  238.  
  239. /* selections for unit menu */
  240.  
  241. #define select_size      1
  242. #define select_color     2
  243. #define select_toplabel  3
  244. #define select_bottlabel 4
  245.  
  246.  
  247.  
  248. #endif
  249.  
  250.  
  251. /* Xlib and Xaw Variables */
  252.  
  253. extern Display      *d3_display;
  254. extern Window        d3_window;
  255. extern GC            d3_gc;
  256. extern int           d3_screen;
  257.  
  258.  
  259.  
  260.  
  261. /* Varibles to control the Windows */
  262.  
  263. extern int d3_displayXsize;
  264. extern int d3_displayYsize;
  265.  
  266. extern bool d3_displayIsReady;
  267. extern bool d3_controlIsReady;
  268.  
  269. extern bool d3_freeze;
  270.  
  271. extern int d3_fontXsize, d3_fontYsize;
  272.  
  273. extern int d3_numberWidth;
  274. extern int d3_shortNumberWidth;
  275.  
  276. extern unsigned d3_textColor;
  277. extern float d3_intens;
  278.  
  279. extern d3_window_type d3_clipWindow;
  280.  
  281.  
  282.  
  283. /* the initial state structure */
  284.  
  285.  
  286. extern d3_state_type  d3_state;
  287.  
  288.  
  289.  
  290. /* unit cube  */
  291.  
  292.  
  293.  
  294. extern cube d3_e_cube;
  295.  
  296.  
  297.  
  298. #endif 
  299.  
  300. /* end of file */
  301. /* lines: */
  302.